package com.hcy.authapi.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.security.oauth2.provider.token.ConsumerTokenServices;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author huchenying
 * @Description
 * @Date 2021/12/21 16:47
 */
@RestController
@RequestMapping("/login")
public class LoginController {

    @Autowired
    @Qualifier("consumerTokenServices")
    private ConsumerTokenServices consumerTokenServices;

    /**
     * 退出登录,并清除redis中的token
     **/
    @GetMapping("/removeToken")
    public Boolean removeToken(String accessToken) {
        return consumerTokenServices.revokeToken(accessToken);
    }
}
